package ltd.bugs.cute.httpclient.checker;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import ltd.bugs.cute.common.spi.checker.Checker;
import ltd.bugs.cute.httpclient.HttpComponentsRequestFactory;

/**
 * httpclient连接池的检查器，定时打印连接池信息
 * 
 * @author zhengzhq
 *
 */
public class HttpClientPoolChecker implements Checker {

  private static Logger logger = LoggerFactory.getLogger(HttpClientPoolChecker.class);

  @Override
  public void check() {
    try {
      logger.info("httpclient pool status: "
          + HttpComponentsRequestFactory.getConnectionManager().getTotalStats().toString());
    } catch (Exception e) {
      logger.error("check httpclient pool error", e);
    }
  }
}
